<template>
  <div class="tble">
      <el-table
    :data="myarr"
    >
    <el-table-column
      prop="num"
      label="编号"
      width="60"
      >
    </el-table-column>
    <el-table-column
      prop="name"
      label="姓名"
      width="120"
      >
    </el-table-column>
     <el-table-column
      prop="humnum"
      label="人员编号"
      width="140"
      >
    </el-table-column>
     <el-table-column
      label="所属角色">
      <template slot-scope="scope">
        <span>{{typeobj[scope.row.typehum]}}</span>
      </template>
    </el-table-column>
    <el-table-column
      label="说明">
      <template slot-scope="scope">
        <span>{{type[scope.row.explain]}}</span>
      </template>
    </el-table-column>
    <el-table-column
      prop="data"
      label="新建时间">
    </el-table-column>
    <el-table-column
      prop="boor"
      label="是否有效"
      width="100"
      >
    </el-table-column>
    <el-table-column
      label="操作">
      <template slot-scope="scope">
        <i class="el-icon-edit"
        style="color:blue"></i>
        <el-button 
        type="text" 
        style="margin-right:4px"
        @click="handleEdit(scope.row)"
        >修改</el-button>
        <i class="el-icon-delete"
        style="color:blue"></i>
        <el-button @click="handleDel(scope.row.id)" type="text" style="margin-right:4px">删除</el-button>
        <i class="el-icon-refresh"
        style="color:blue"></i>
        <el-button type="text" style="margin-right:4px">重置</el-button>
      </template>
      
    </el-table-column>
  </el-table>

  </div>
</template>

<script>
import { deleteByIdApi } from '../../../api/PoliceofficerApi'
export default {
    props:['myarr'],
    data() {
      return {
        
        typeobj:{
            1:'管理员',
            2:'街道负责人',
           
        },
        type:{
            1:'该账号拥有所有权限',
            2:'上传车位信息'
        },
        
            
        
      }
    },
    methods:{
      handleEdit(row){
        this.$emit('opendialog',row)
      },
        handleDel(id){
          deleteByIdApi({id:id}).then(res=>{
            if(res.code == 200){
              this.$emit('resetTable')
            }
          })
        }
       

    },
  }

</script>

<style>
.tble{
  margin-top: -30px;
}
</style>